/* javascript for profile.html */

function change_profile() {
    var validator = new Chujue_Validator();
    if (!validator.validation(".cj-profile-validator"))
        return false;

    var req = new Chujue_Request();
    req.url = "/auth/change-profile";
    var new_realname = $("#txt-realname").val();
    var new_email = $("#txt-email").val();
    var new_telephone = $("#txt-telephone").val();
    req.send_data = {
        "new-realname": new_realname,
        "new-email": new_email,
        "new-telephone": new_telephone,
    };

    req.ajax_req();
}

function change_passwd() {
    var validator = new Chujue_Validator();
    if (!validator.validation(".cj-passwd-validator"))
        return false;


    var req = new Chujue_Request();
    req.url = "/auth/change-passwd";
    var old_passwd = MD5($("#txt-old-passwd").val());
    var new_passwd = MD5($("#txt-new-passwd").val());
    req.send_data = {
        "old-passwd": old_passwd,
        "new-passwd": new_passwd,
    };

    req.ajax_req();
}

